From c2afa674e23d4e16415f34323cba2268bf6c4f52 Mon Sep 17 00:00:00 2001 From: William Hua Date: Wed, 7 Jan 2015 12:18:03 -0500 Subject: [PATCH] mir: stop forwarding motion events to subwindows --- gdk/mir/gdkmir-private.h | 12 ------ gdk/mir/gdkmireventsource.c | 80 ------------------------------------- gdk/mir/gdkmirwindowimpl.c | 44 -------------------- 3 files changed, 136 deletions(-) diff --git a/gdk/mir/gdkmir-private.h b/gdk/mir/gdkmir-private.h index 635d57554b..e819a7f0f1 100644 --- a/gdk/mir/gdkmir-private.h +++ b/gdk/mir/gdkmir-private.h @@ -133,16 +133,4 @@ void _gdk_mir_print_resize_event (const MirResizeEvent *event); void _gdk_mir_print_event (const MirEvent *event); -/* TODO: Remove once we have proper transient window support. */ -GdkWindow * _gdk_mir_window_get_visible_transient_child (GdkWindow *window, - gint x, - gint y, - gint *out_x, - gint *out_y); - -/* TODO: Remove once we have proper transient window support. */ -void _gdk_mir_window_transient_children_foreach (GdkWindow *window, - GFunc func, - gpointer user_data); - #endif /* __GDK_PRIVATE_MIR_H__ */ diff --git a/gdk/mir/gdkmireventsource.c b/gdk/mir/gdkmireventsource.c index 71883034f0..b0e3771815 100644 --- a/gdk/mir/gdkmireventsource.c +++ b/gdk/mir/gdkmireventsource.c @@ -292,44 +292,6 @@ handle_key_event (GdkWindow *window, const MirKeyEvent *event) } } -/* TODO: Remove once we have proper transient window support. */ -typedef struct -{ - gdouble x; - gdouble y; - guint32 event_time; - gboolean cursor_inside; -} LeaveInfo; - -/* TODO: Remove once we have proper transient window support. */ -static void -generate_leave_events (GdkWindow *window, - LeaveInfo *user_data) -{ - GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl); - LeaveInfo info = *user_data; - gdouble x; - gdouble y; - gboolean cursor_inside; - MirMotionButton button_state; - - info.x -= window->x; - info.y -= window->y; - - if (info.cursor_inside) - info.cursor_inside = 0 <= info.x && info.x < window->width && 0 <= info.y && info.y < window->height; - - _gdk_mir_window_impl_get_cursor_state (impl, &x, &y, &cursor_inside, &button_state); - - if (cursor_inside && !info.cursor_inside) - { - _gdk_mir_window_impl_set_cursor_state (impl, x, y, FALSE, button_state); - generate_crossing_event (window, GDK_LEAVE_NOTIFY, info.x, info.y, info.event_time); - } - - _gdk_mir_window_transient_children_foreach (window, (GFunc) generate_leave_events, &info); -} - static void handle_motion_event (GdkWindow *window, const MirMotionEvent *event) { @@ -351,26 +313,6 @@ handle_motion_event (GdkWindow *window, const MirMotionEvent *event) modifier_state = get_modifier_state (event->modifiers, event->button_state); event_time = NANO_TO_MILLI (event->event_time); - /* TODO: Remove once we have proper transient window support. */ - { - LeaveInfo info; - - info.x = x; - info.y = y; - info.event_time = event_time; - info.cursor_inside = TRUE; - - _gdk_mir_window_transient_children_foreach (window, (GFunc) generate_leave_events, &info); - } - - /* The Mir events generate hover-exits even while inside the window so - counteract this by always generating an enter notify on all other events */ - if (!cursor_inside && event->action != mir_motion_action_hover_exit) - { - cursor_inside = TRUE; - generate_crossing_event (window, GDK_ENTER_NOTIFY, x, y, event_time); - } - /* Update which window has focus */ _gdk_mir_pointer_set_location (get_pointer (window), x, y, window, modifier_state); switch (event->action) @@ -536,28 +478,6 @@ gdk_mir_event_source_convert_events (GdkMirEventSource *source) */ if (window != NULL) { - /* TODO: Remove once we have proper transient window support. */ - if (event->event.type == mir_event_type_motion) - { - GdkWindow *child; - gint x; - gint y; - - x = event->event.motion.pointer_coordinates[0].x; - y = event->event.motion.pointer_coordinates[0].y; - - child = _gdk_mir_window_get_visible_transient_child (window, x, y, &x, &y); - - if (child && child != window) - { - window = child; - - event->event.motion.pointer_count = MAX (event->event.motion.pointer_count, 1); - event->event.motion.pointer_coordinates[0].x = x; - event->event.motion.pointer_coordinates[0].y = y; - } - } - if (source->log_events) _gdk_mir_print_event (&event->event); diff --git a/gdk/mir/gdkmirwindowimpl.c b/gdk/mir/gdkmirwindowimpl.c index b866868c8c..12451591fa 100644 --- a/gdk/mir/gdkmirwindowimpl.c +++ b/gdk/mir/gdkmirwindowimpl.c @@ -924,50 +924,6 @@ gdk_mir_window_impl_set_transient_for (GdkWindow *window, ensure_no_surface (window); } -/* TODO: Remove once we have proper transient window support. */ -GdkWindow * -_gdk_mir_window_get_visible_transient_child (GdkWindow *window, - gint x, - gint y, - gint *out_x, - gint *out_y) -{ - GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl); - GdkWindow *child = NULL; - GList *i; - - if (x < window->x || x >= window->x + window->width || - y < window->y || y >= window->y + window->height) - return NULL; - - x -= window->x; - y -= window->y; - - for (i = impl->transient_children; i && !child; i = i->next) - { - if (GDK_MIR_WINDOW_IMPL (GDK_WINDOW (i->data)->impl)->visible) - child = _gdk_mir_window_get_visible_transient_child (i->data, x, y, out_x, out_y); - } - - if (child) - return child; - - *out_x = x; - *out_y = y; - - return window; -} - -/* TODO: Remove once we have proper transient window support. */ -void -_gdk_mir_window_transient_children_foreach (GdkWindow *window, - GFunc func, - gpointer user_data) -{ - GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl); - g_list_foreach (impl->transient_children, func, user_data); -} - static void gdk_mir_window_impl_get_frame_extents (GdkWindow *window, GdkRectangle *rect) -- 2.30.2